-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-10-30
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'

local MTCPMgmt = {}

---@class MTCPMgmt.SyncRole
---@field SyncRole integer
local TSyncRole = {}
TSyncRole.__index = TSyncRole
TSyncRole.group = {}

local function TSyncRole_from_obj(obj)
    return setmetatable(obj, TSyncRole)
end

function TSyncRole.new(SyncRole)
    return TSyncRole_from_obj({SyncRole = SyncRole or 0})
end
---@param obj MTCPMgmt.SyncRole
function TSyncRole:init_from_obj(obj)
    self.SyncRole = obj.SyncRole or 0
end

function TSyncRole:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TSyncRole.group)
end

TSyncRole.from_obj = TSyncRole_from_obj

TSyncRole.proto_property = {'SyncRole'}

TSyncRole.default = {0}

TSyncRole.struct = {{name = 'SyncRole', is_array = false, struct = nil}}

function TSyncRole:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'SyncRole', self.SyncRole, 'uint8', false, errs, need_convert)

    TSyncRole:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TSyncRole.proto_property, errs, need_convert)
    return self
end

function TSyncRole:unpack(_)
    return self.SyncRole
end

MTCPMgmt.SyncRole = TSyncRole

---@class MTCPMgmt.Port
---@field Port integer
local TPort = {}
TPort.__index = TPort
TPort.group = {}

local function TPort_from_obj(obj)
    return setmetatable(obj, TPort)
end

function TPort.new(Port)
    return TPort_from_obj({Port = Port or 51000})
end
---@param obj MTCPMgmt.Port
function TPort:init_from_obj(obj)
    self.Port = obj.Port or 51000
end

function TPort:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TPort.group)
end

TPort.from_obj = TPort_from_obj

TPort.proto_property = {'Port'}

TPort.default = {0}

TPort.struct = {{name = 'Port', is_array = false, struct = nil}}

function TPort:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Port', self.Port, 'uint16', false, errs, need_convert)

    TPort:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TPort.proto_property, errs, need_convert)
    return self
end

function TPort:unpack(_)
    return self.Port
end

MTCPMgmt.Port = TPort

---@class MTCPMgmt.Address
---@field Address string
local TAddress = {}
TAddress.__index = TAddress
TAddress.group = {}

local function TAddress_from_obj(obj)
    return setmetatable(obj, TAddress)
end

function TAddress.new(Address)
    return TAddress_from_obj({Address = Address or [=[]=]})
end
---@param obj MTCPMgmt.Address
function TAddress:init_from_obj(obj)
    self.Address = obj.Address or [=[]=]
end

function TAddress:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TAddress.group)
end

TAddress.from_obj = TAddress_from_obj

TAddress.proto_property = {'Address'}

TAddress.default = {''}

TAddress.struct = {{name = 'Address', is_array = false, struct = nil}}

function TAddress:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Address', self.Address, 'string', false, errs, need_convert)

    TAddress:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TAddress.proto_property, errs, need_convert)
    return self
end

function TAddress:unpack(_)
    return self.Address
end

MTCPMgmt.Address = TAddress

---@class MTCPMgmt.Identifier
---@field Identifier integer
local TIdentifier = {}
TIdentifier.__index = TIdentifier
TIdentifier.group = {}

local function TIdentifier_from_obj(obj)
    return setmetatable(obj, TIdentifier)
end

function TIdentifier.new(Identifier)
    return TIdentifier_from_obj({Identifier = Identifier or 255})
end
---@param obj MTCPMgmt.Identifier
function TIdentifier:init_from_obj(obj)
    self.Identifier = obj.Identifier or 255
end

function TIdentifier:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TIdentifier.group)
end

TIdentifier.from_obj = TIdentifier_from_obj

TIdentifier.proto_property = {'Identifier'}

TIdentifier.default = {0}

TIdentifier.struct = {{name = 'Identifier', is_array = false, struct = nil}}

function TIdentifier:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Identifier', self.Identifier, 'uint8', false, errs, need_convert)

    TIdentifier:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TIdentifier.proto_property, errs, need_convert)
    return self
end

function TIdentifier:unpack(_)
    return self.Identifier
end

MTCPMgmt.Identifier = TIdentifier

---@class MTCPMgmt.Enabled
---@field Enabled boolean
local TEnabled = {}
TEnabled.__index = TEnabled
TEnabled.group = {}

local function TEnabled_from_obj(obj)
    return setmetatable(obj, TEnabled)
end

function TEnabled.new(Enabled)
    return TEnabled_from_obj({Enabled = Enabled or false})
end
---@param obj MTCPMgmt.Enabled
function TEnabled:init_from_obj(obj)
    self.Enabled = obj.Enabled or false
end

function TEnabled:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TEnabled.group)
end

TEnabled.from_obj = TEnabled_from_obj

TEnabled.proto_property = {'Enabled'}

TEnabled.default = {false}

TEnabled.struct = {{name = 'Enabled', is_array = false, struct = nil}}

function TEnabled:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'Enabled', self.Enabled, 'bool', false, errs, need_convert)

    TEnabled:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TEnabled.proto_property, errs, need_convert)
    return self
end

function TEnabled:unpack(_)
    return self.Enabled
end

MTCPMgmt.Enabled = TEnabled

return MTCPMgmt
